
using System;
using System.Collections;
using System.Web.UI.WebControls;

using Awaken.Framework;
using Nullables;

namespace Northwind.Domain.Entities
{
    public partial class Supplier : IEntity
    {
        protected static SupplierBroker broker;
        public static SupplierBroker Broker
        {
            get
            {
                if (broker == null)
                {
                    broker = new SupplierBroker();
                }
                return broker;
            }
        }

        #region IEntity Members

        public string EntityID
        {
            get { return string.Empty; }
        }
        
        public string EntityName
        {
            get { return string.Empty; }
        }

        public void Save()
        {
            Broker.Save(this);
        }
        
        public void Delete()
        {
            Broker.Delete(this);
        }
        
        #endregion
    
        #region Constructor
        
        public Supplier()
        {
            // Default, no arg constructor.
        }
        
        #endregion
            
        #region Public Properties / Protected Fields
                        
        
        protected System.Int32? _SupplierID;
        public System.Int32? SupplierID
        {
            get{ return _SupplierID; }
            set{ _SupplierID=value; }
        }
        
        protected string _CompanyName;
        public string CompanyName
        {
            get{ return _CompanyName; }
            set{ _CompanyName=value; }
        }
        
        protected string _ContactName;
        public string ContactName
        {
            get{ return _ContactName; }
            set{ _ContactName=value; }
        }
        
        protected string _ContactTitle;
        public string ContactTitle
        {
            get{ return _ContactTitle; }
            set{ _ContactTitle=value; }
        }
        
        protected string _Address;
        public string Address
        {
            get{ return _Address; }
            set{ _Address=value; }
        }
        
        protected string _City;
        public string City
        {
            get{ return _City; }
            set{ _City=value; }
        }
        
        protected string _Region;
        public string Region
        {
            get{ return _Region; }
            set{ _Region=value; }
        }
        
        protected string _PostalCode;
        public string PostalCode
        {
            get{ return _PostalCode; }
            set{ _PostalCode=value; }
        }
        
        protected string _Country;
        public string Country
        {
            get{ return _Country; }
            set{ _Country=value; }
        }
        
        protected string _Phone;
        public string Phone
        {
            get{ return _Phone; }
            set{ _Phone=value; }
        }
        
        protected string _Fax;
        public string Fax
        {
            get{ return _Fax; }
            set{ _Fax=value; }
        }
        
        protected string _HomePage;
        public string HomePage
        {
            get{ return _HomePage; }
            set{ _HomePage=value; }
        }
        
        
        
        // One-To-Many: Products.SupplierID  
        protected IList _ProductList;
        public IList ProductList
        {
            get{ return _ProductList; }
            set{ _ProductList=value; }
        }
        
        
                
        
        
        
        #endregion
    }
    
    #region SupplierBroker

    public partial class SupplierBroker : IBroker
    {
        #region IBroker Members

        public Type EntityType
        {
            get { return typeof(Supplier); }
        }
        
        public Supplier GetByID(object id)
        {
            return (Supplier)Awaken.Framework.Gateway.GetByID(EntityType, id);
        }

        public IList GetAll()
        {
            return Awaken.Framework.Gateway.GetAll(EntityType);
        }

        public void Save(IEntity entity)
        {
            Awaken.Framework.Gateway.Save(entity);
        }
        
        public void Delete(IEntity entity)
        {
            Awaken.Framework.Gateway.Delete(entity);
        }
        
        #endregion
    }
    #endregion
}
